建立一個UIImageView的位置與範圍:
//UIImageView(frame: CGRect)
let myPet = UIImageView(
frame: CGRect(
x: 0, y: 0, width: 200, height: 200))
放置或改變圖片檔案:
//UIImage(named:)
myPet.image = UIImage(named: "MyDog.jpg")
設置新的位置並放入畫面中:
myPet.center = CGPoint(
x: fullScreenSize.width * 0.5,
y: fullScreenSize.height * 0.5)
self.view.addSubview(myPet)